<template>
  <div>
    <van-cell-group>
      <van-cell v-for="(i,index) in list" :key="index" :title="i.ask" is-link @click="changeQ(i)" />
    </van-cell-group>
    <van-popup v-model="show" position="bottom" style="height: 300px">
      <div class="head">
        问题详情
        <div @click="show=false">关闭</div>
      </div>
      <div class="q">
        <p>Q: {{obj.ask}}</p>
        <p>A: {{obj.content}}</p>
      </div>
    </van-popup>
  </div>
</template>
<script>
import { wxShare } from "@/mixin/share";
export default {
  name: "problem",
  data() {
    return {
      list: [],
      show: false,
      obj: {}
    };
  },
  mixins: [wxShare],
  async mounted() {
    let res = await this.$http(`api/index/get_faq`);
    console.log(res);
    this.list = res.data;
  },
  methods: {
    changeQ(i) {
      this.obj = i;
      this.show = true;
    }
  }
};
</script>
<style scoped>
.van-nav-bar {
  text-align: left;
  background: rgba(242, 242, 242, 1);
}
.van-nav-bar__left .van-nav-bar__text {
  color: black;
  font-size: 3rem;
}
.van-nav-bar__title {
  max-width: 70%;
}
.van-icon,
.van-icon::before {
  font-size: 20px;
  color: black;
}
.van-icon-arrow:before {
  font-size: 1.5rem;
  color: rgba(210, 210, 210, 1);
}
.van-cell {
  padding: 20px 16px;
}
.van-cell__left-icon {
  font-size: 0.5rem;
}
.van-cell__title {
  font-family: PingFang SC;
  font-size: 1rem;
}
.head {
  width: 100%;
  text-align: center;
  font-size: 16px;
  height: 36px;
  line-height: 36px;
  position: relative;
}
.head > div {
  position: absolute;
  line-height: 36px;
  font-size: 14px;
  top: 0;
  right: 20px;
  flex-wrap: bold;
}
.q {
  padding: 20px;
  font-size: 14px;
}
.q p {
  margin-bottom: 20px;
}
</style>